<%-- 
    Document   : index
    Created on : 10-nov-2011, 11.58.01
    Author     : Giuseppe
--%>

<%@page import="java.util.List"%>

<%
    List<String[]> locali = (List<String[]>) session.getAttribute("locali");
    List<String[]> eventi = (List<String[]>) session.getAttribute("eventi");
    if (locali == null || eventi == null) {
%>
<jsp:forward page="/Servlet?action=random"/>

<% } else {%>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <script src="JS/style.js" type="text/javascript"></script>
        <link rel="stylesheet" type="text/css" href="style.css">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>HomePage</title>
    </head>
    <body>
        <%@include file="header.jsp" %>
        <div id="content">
            <fieldset>
                <legend>Locali</legend>
                <table><tr>
                        <%
                            if (!locali.isEmpty()) {
                                for (int i = 0; i < locali.size(); i++) {
                                    String[] temp = locali.get(i);
                        %>
                        <td>
                            <div class="rnd">
                                <fieldset>
                                    <a href="/EsameSSCSWeb-war/Servlet?action=locale&nome=<%=temp[0]%>"><img src="<%=temp[1]%>" width="100" height="100"/></a><br />
                                        <%=temp[0]%>
                                </fieldset>
                            </div>
                        </td>
                        <%
                                }
                            }
                        %>
                </table>
            </fieldset>

            <fieldset>
                <legend>Eventi</legend>
                <table><tr>
                        <%
                            if (!eventi.isEmpty()) {
                                for (int i = 0; i < eventi.size(); i++) {
                                    String[] temp = eventi.get(i);
                        %>
                        <td>
                            <div class="rnd">
                                <fieldset>
                                    <a href="/EsameSSCSWeb-war/Servlet?action=evento&nome=<%=temp[0]%>"><img src="<%=temp[1]%>" width="100"/></a><br />
                                        <%=temp[0]%>
                                </fieldset>
                            </div>
                        </td>
                        <%
                                }
                            }
                        %>
                </table>
            </fieldset>
        </div>
    </body>
</html>

<%
        session.setAttribute("eventi", null);
        session.setAttribute("locali", null);
    }
%>